package project.elements.priority;

import project.elements.base.Job;
import project.elements.base.Task;

public class PriorityBySmallestDynamicSlack extends PriorityCalculatorWithActualTime {

	public PriorityBySmallestDynamicSlack() {
		super();
	}

	@Override
	public double calculatePriority(Job job) {
		long actualTime = 0;
		for (Task task : job.getTasks()) {
			actualTime += task.getMachine().getIdleTime();
			actualTime += task.getMachine().getMachineActualTime();
			break;
		}
		return -(job.getDueDate() - actualTime - job.getCost());
	}

	@Override
	public String toString() {
		return "Smallest Dynamic Slack";
	}
}
